{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# `auto_arima` benchmarks\n",
    "\n",
    "This notebook benchmarks the `auto_arima` function with various hyperparametric combinations. All of the benchmarks are used with the `wineind` data found in `pmdarima.datasets.load_wineind`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Pyramid version: 1.0.0-dev\n"
     ]
    }
   ],
   "source": [
    "import pmdarima\n",
    "from pmdarima.datasets import load_wineind\n",
    "\n",
    "wineind = load_wineind()\n",
    "print(\"Pyramid version: %s\" % pmdarima.__version__)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import gc\n",
    "from datetime import datetime\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "\n",
    "# to store the results\n",
    "stepwise_results = []\n",
    "grid_results = []\n",
    "mu_second = 0.0 + 10 ** 6 # number of microseconds in a second"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "def benchmark(x, results, **kwargs):\n",
    "    from pmdarima.arima import auto_arima\n",
    "    \n",
    "    gc.collect()\n",
    "    \n",
    "    # start\n",
    "    tstart = datetime.now()\n",
    "    auto_arima(x, **kwargs)\n",
    "    delta = datetime.now() - tstart\n",
    "    # stop\n",
    "    \n",
    "    results.append(delta.seconds + delta.microseconds / mu_second)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/envs/pmdenv/lib/python3.6/site-packages/pmdarima/arima/auto.py:864: ModelFitWarning: Unable to fit ARIMA for order=(1, 1, 1) seasonal_order=(0, 0, 0, 1); data is likely non-stationary. (if you do not want to see these warnings, run with error_action=\"ignore\")\n",
      "  ModelFitWarning)\n",
      "/anaconda3/envs/pmdenv/lib/python3.6/site-packages/pmdarima/arima/auto.py:864: ModelFitWarning: Unable to fit ARIMA for order=(1, 1, 1) seasonal_order=(0, 0, 0, 1); data is likely non-stationary. (if you do not want to see these warnings, run with error_action=\"ignore\")\n",
      "  ModelFitWarning)\n"
     ]
    },
    {
     "data": {
      "image/png": "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ntxuT9unAK+R+gb4IfKTIdT4LrCb3S/lnQL+kXcCdyXOtZj9XohzqWpP+JeQmaPPbOrNPHwL+BOwmd+75n8gF0jVp+wH4PLApuV2V116d7M9XgR/ybpANIjcvsBH4DXm/YA51neT+Gg5gXd7P6BeSvlvy9udi4O86+G/f1bUeQ+7KolVJXd8HeuX9vDySjP8d8MFi/tsnfZvb7rPO7tMsb34Ht5mZpfKchZmZpXJYmJlZKoeFmZmlcliYmVkqh4WZmaVyWJiZWSqHhZmZpXJYmJlZqv8PaeFAmJ/5zHwAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "def fit_benchmark(**kwargs):\n",
    "    # pop these, since we'll manually assign\n",
    "    kwargs.pop('stepwise', None)\n",
    "    kwargs.pop('n_jobs', None)\n",
    "    \n",
    "    for stepwise, results in ((True, stepwise_results), (False, grid_results)):\n",
    "        benchmark(wineind, results, **kwargs)\n",
    "        \n",
    "def plot_benchmarks():\n",
    "    plt.figure('auto_arima benchmark results')\n",
    "    xx = len(stepwise_results)\n",
    "    plt.scatter(x=xx, y=stepwise_results, label='stepwise')\n",
    "    plt.scatter(x=xx, y=grid_results, label='grid')\n",
    "    plt.legend(loc='upper left')\n",
    "    plt.ylabel('Time (s)')\n",
    "    plt.show()\n",
    "\n",
    "# fit with all default args\n",
    "fit_benchmark(suppress_warnings=True)\n",
    "plot_benchmarks()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [conda env:pmdenv]",
   "language": "python",
   "name": "conda-env-pmdenv-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
